package com.wangjiang.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wangjiang.dao.UserDao;
import com.wangjiang.model.UserModel;
import com.wangjiang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service(value = "userService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public int addUser(UserModel userModel) {
        return userDao.insert(userModel);
    }

    @Override
    public PageInfo<UserModel> findAllUser(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<UserModel> userList = userDao.selectUser();
        PageInfo result = new PageInfo(userList);
        return result;
    }

}
